package spring.tx.xml.service.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 验证事务的传播行为
 * 由TopService作为顶层方法调用 StudentService 的方法
 * 顶层方法添加事务
 */

@Service
public class TopService {

    @Autowired
    private StudentService studentService;

    @Transactional
    public void topService(){
        studentService.changeAge();
        studentService.changeName();
    }
}
